/* eslint-disable no-shadow */
export function count({ search }) {
  return RSocket.rr({
    route: 'stations.count',
    args: { search },
  });
}

export function search({ search, pg }) {
  return RSocket.rs({
    route: 'stations',
    args: { search, pg },
  });
}

export function get(id) {
  return RSocket.rr({
    route: `stations.${id}`,
  });
}

export function update(station) {
  return RSocket.rr({
    route: 'stations.update',
    data: station,
  });
}

export function create(channel) {
  return RSocket.rr({
    route: 'stations.create',
    data: channel,
  });
}

export function remove(id) {
  return RSocket.rr({
    route: `stations.${id}.delete`,
  });
}

/**
 * 获取公司
 * @param {*} id
 * @returns
 */
export function getCompany({ search, pg }) {
  return RSocket.rs({
    route: 'companys',
    args: {
      search,
      pg,
    },
  });
}

/**
 * 条件分页查询第三方站点
 * @param {*} id
 * @returns
 */
export function getStationOther({ search, pg }) {
  return RSocket.rs({
    route: 'stations.other',
    args: { search, pg },
  });
}

/**
 * 条件分页查询第三方站点数量
 * @param {*} id
 * @returns
 */
export function getStationOtherCount({ search }) {
  return RSocket.rr({
    route: 'stations.other.count',
    args: {
      search,
    },
  });
}

/**
 * 条件分页查询第三方站点数量
 * @param {*} id
 * @returns
 */
export function getRecommendStation(args) {
  return RSocket.rs({
    route: 'stations.recommend.other.station',
    args: {
      ...args,
    },
  });
}

/**
 * 查询指定类型分组信息
 * args: companyId, type 类型
 * @returns 区域列表
 */
export function allRegions(args) {
  return RSocket.rs({
    route: 'stations.other.city.group',
    args: {
      ...args,
    },
    // binary: true,
  });
}

/**
 * 初始化平台线路
 */
export function getRoutesInit() {
  return RSocket.rr({
    route: 'routes.init',
  });
}
